
#include "Ouden\ouden.h"

using ouden::scene::ODN_Scene;
using ouden::scene::ODN_SceneObject;
using ouden::utility::Vector3D;
using ouden::utility::RGBAColor;
using ouden::utility::random::rnd;

class CTestEntity2 : public ODN_SceneObject 
{
	
public:
	
	CTestEntity2(ODN_Scene* Scene) : ODN_SceneObject(Scene), color(RGBAColor(rnd(), rnd(), rnd(), rnd())), Pos(Vector3D(rnd() * 640 - 320, rnd() * 480 - 240)) 		{}
	~CTestEntity2()		{}
	
	//Main update function
	virtual bool Update()
	{
		
		Pos[1] += 5;
		
	}
	
	virtual bool Draw()
	{
		
		glColor4f(color.r, color.g, color.b, color.a);
		
		glBlendFunc(GL_SRC_ALPHA, GL_ONE);
		
		glBindTexture(GL_TEXTURE_2D, 0);
		
		glBegin(GL_TRIANGLES);
			
			glTexCoord2f(0, 0);
			glVertex3f(Pos[0], Pos[1], Pos[2]);
			
			glTexCoord2f(1, 0);
			glVertex3f(Pos[0] + 10, Pos[1], Pos[2]);
			
			glTexCoord2f(0, 1);
			glVertex3f(Pos[0], Pos[1] + 10, Pos[2]);
			
		glEnd();
		
		glBindTexture(GL_TEXTURE_2D, 0);
		
		glBlendFunc(GL_SRC_ALPHA, GL_ZERO);
		
	}
	
private:
	
	RGBAColor color;
	Vector3D Pos;
	
};
